/**
 * Copyright(C) 2008 Matthias Braunhofer
 * All rights reserved
 *
 * Created on: 26.07.2008
*/

package it.cums.ui.editors.supplier;

import it.cums.core.model.Supplier;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;

public class SupplierEditorInput implements IEditorInput {
	private final Supplier supplier;

	public SupplierEditorInput(Supplier supplier) {
		this.supplier = supplier;
	}

	
	public boolean exists() {
		// TODO Auto-generated method stub
		return false;
	}

	
	public ImageDescriptor getImageDescriptor() {
		// TODO Auto-generated method stub
		return null;
	}

	
	public String getName() {
		return supplier.getName();
	}

	
	public IPersistableElement getPersistable() {
		// TODO Auto-generated method stub
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.ui.IEditorInput#getToolTipText()
	 */
	
	public String getToolTipText() {
		return supplier.getName();
	}

	@SuppressWarnings("unchecked")
	
	public Object getAdapter(Class adapter) {
		// TODO Auto-generated method stub
		return null;
	}

	
	public boolean equals(Object obj) {
		if (super.equals(obj)) {
			return true;
		}
		if (obj instanceof SupplierEditorInput) {
			return supplier.getId() == ((SupplierEditorInput) obj).getSupplier().getId();
		}
		return false;
	}
	
	public Supplier getSupplier() {
		return supplier;
	}

	
	public int hashCode() {
		return supplier.getId();
	}

}

